{template 'admin','header'}
<body {if !isset($parentid)} onload="getchild({$parentid})"{/if}>
<script type="text/javaScript">
function getchild(parentid)
{
	$.ajax({
	  url: '{$self_dir}/menu.php?',
	  data: "action=getchild&parentid="+parentid,
	  cache: false,
	  success: function(html)
	  {
		  parentid == 0 ?  $('#parent').html(html) : $('#parent').append(html);
	  }
	});
}
</script>
<form action="" method="POST" onsubmit="return r_submit(this);" name="myform">
<table cellpadding="2" cellspacing="1" class="table_form">
        <caption>添加菜单</caption>
        <tr>
            <th width="20%"><font color="red">*</font><strong>上级菜单</strong></th>
            <td>
                <input name="parentid" id="parentid" type="hidden" value="{$parentid}">
                {if isset($parentname)}<span id="parentname">{$parentname}</span>{/if}
                <span id="parent"></span>
                <a href="{$self_url}?action=add&forward={$parent_forward}" onclick="javascript:getchild(0);$('#parentname').hide();">重选</a>
            </td>
        </tr>
        <tr>
            <th width="20%"><font color="red">*</font><strong>菜单名称</strong></th>
            <td>
                <input type="text" id="name" name="name" size="20" value=""/>
            </td>
        </tr>
        <tr>
            <th><strong>菜单图片</strong></th>
            <td>
                {form::image("image","image")}
            </td>
        </tr>
        <tr>
            <th><strong>菜单链接</strong></th>
            <td>
                <input type="text" id="url" name="url" size="20" value=""/>
            </td>
        </tr>
        <tr>
            <th><strong>默认是否展开</strong></th>
            <td>
                <input type="checkbox" name="isopen" value="1" checked />
            </td>
        </tr>
        <tr>
            <th></th>
            <td>
                <input type="submit" value=" 确定 " class="button_style">&nbsp;
                <input type="button" class="button_style" onclick="self.location='{urldecode($forward)}'" value=" 返回 ">
            </td>
        </tr>
    </table>
    <input type="hidden" name="forward" value="{$forward}">
</form>
{template 'admin','footer'}